<?php

/**
 * Plantilla form base class.
 *
 * @method Plantilla getObject() Returns the current form's model object
 *
 * @package    sms
 * @subpackage form
 * @author     Patricio Andrés Córdova De La Cruz
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BasePlantillaForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id_plantilla'     => new sfWidgetFormInputHidden(),
      'nombre_plantilla' => new sfWidgetFormInputText(),
      'texto'            => new sfWidgetFormTextarea(),
      'id_tipo'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('TipoPlantilla'), 'add_empty' => false)),
      'estado'           => new sfWidgetFormInputText(),
      'masivo'           => new sfWidgetFormInputText(),
      'dias'             => new sfWidgetFormInputText(),
      'hora_inicial'     => new sfWidgetFormTime(),
      'hora_final'       => new sfWidgetFormTime(),
    ));

    $this->setValidators(array(
      'id_plantilla'     => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id_plantilla')), 'empty_value' => $this->getObject()->get('id_plantilla'), 'required' => false)),
      'nombre_plantilla' => new sfValidatorString(array('max_length' => 64, 'required' => false)),
      'texto'            => new sfValidatorString(array('required' => false)),
      'id_tipo'          => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('TipoPlantilla'))),
      'estado'           => new sfValidatorInteger(array('required' => false)),
      'masivo'           => new sfValidatorInteger(array('required' => false)),
      'dias'             => new sfValidatorString(array('max_length' => 20, 'required' => false)),
      'hora_inicial'     => new sfValidatorTime(array('required' => false)),
      'hora_final'       => new sfValidatorTime(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('plantilla[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Plantilla';
  }

}
